#
# Build the documentation
#
# INCLUDE (Documentation)

  FIND_PACKAGE2(PUBLIC UnixCommands)
  FIND_PACKAGE2(PUBLIC Gnuplot)
  FIND_PACKAGE2(PUBLIC HTMLHelp)
  FIND_PACKAGE2(PUBLIC Perl)
  FIND_PACKAGE2(PUBLIC Wget)

  SET(DOXYGEN_PROJECT_NAME FairRoot)

  SET(DOXYGEN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
  SET(DOXYGEN_PROJECT_SOURCE_DIR "${CMAKE_SOURCE_DIR}")
  SET(DOXYGEN_BINARY_LOCATIONS_DIR "${CMAKE_SOURCE_DIR}")
  SET(DOXYGEN_BINARY_LOCATIONS
       "")
  SET(DOXYGEN_IGNORE_PREFIX "svn")

  #
  # Configure the script and the doxyfile, then add target
  #
  CONFIGURE_FILE(
    ${CMAKE_CURRENT_SOURCE_DIR}/doxyfile.in
    ${CMAKE_CURRENT_BINARY_DIR}/doxyfile @ONLY IMMEDIATE)

  CONFIGURE_FILE(
    ${CMAKE_CURRENT_SOURCE_DIR}/doc_makeall.sh.in
    ${CMAKE_CURRENT_BINARY_DIR}/doc_makeall.sh @ONLY IMMEDIATE)

  ADD_CUSTOM_TARGET(DoxygenDoc ALL
    COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/doc_makeall.sh)

  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/doc/html"
          DESTINATION "${CMAKE_INSTALL_DOCDIR}"
          COMPONENT Doxygen)
